import request from '@/utils/request';
export async function getOperateList(params: any) {
  return request('/oa/opLog/query', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function uploadFile(params: any) {
  return request('/api/upload/resource', {
    method: 'POST',
    data: params
  });
}

export async function queryLogout(params: { type: 'cm' | 'bk' | 'ls' | 'gs' }) {
  let url: string = ''
  switch (params.type) {
    case 'cm':
      url = '/api/user/logout'
      break;
    case 'bk':
      url = '/bank/user/logout'
      break;
    case 'ls':
      url = '/oa/user/logout'
      break;
    case 'gs':
      url = '/tp/user/logout'
      break;
    default:
      break;
  }
  return request(url, {
    method: 'POST',
    data: params
  });
}


// 项目详情
export async function getMarginAccountDetail(params?: any) {
  return request('/api/project/getByProject', {
    method: 'GET',
    params,
  });
}

// 销户详情
export async function cancelDetail(params: any) {
  return request('/bank/marginAccountApply/getCancelDetail', {
    method: 'GET',
    params
  });
}


// 劳监列表
export async function getBranchDepartmentList(params?: any) {
  return request('/api/department/branchDepartmentList', {
    method: 'GET',
    params,
  });
}

// 全部已读
export async function readAll(params: any) {
  return request('/api/message/readAll', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}

// 文件下载
export async function getFile(url: string, params?: any) {
  return request(url, {
    method: 'GET',
    params,
  });
}

// 
export async function getExcelList(params?: any) {
  return request('/open/bank/parseDescriptionOfBranchAccessFile', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}

// 处理明细
export async function getOperateLog(params?: any) {
  return request('/api/operateLog/list', {
    method: 'GET',
    params,
  });
}

// 项目详情项目人员管理
export async function getCorpProjectUserList(params?: any) {
  return request('/api/corpProjectUser/list', {
    method: 'GET',
    params,
  });
}

// 查询项目下劳务公司
export async function getProjectLaborCompany(params?: any) {
  return request('/oa/projectGroupWorker/projectLaborCompany', {
    method: 'GET',
    params,
  });
}
// 查询项目下劳务公司公共
export async function getProjectLaborCompanyApi(params?: any) {
  return request('/api/detail/projectGroupWorker/projectLaborCompany', {
    method: 'GET',
    params,
  });
}

// 查询班组组织架构
export async function getProjectGroup(params?: any) {
  return request('/oa/projectGroupWorker/projectGroup', {
    method: 'GET',
    params,
  });
}
// 查询班组组织架构公共
export async function getProjectGroupApi(params?: any) {
  return request('/api/detail/projectGroupWorker/projectGroup', {
    method: 'GET',
    params,
  });
}

// 查询班组组织架构
export async function getGroupWorkerByGroupId(params?: any) {
  return request('/oa/projectGroupWorker/getGroupWorkerByGroupId', {
    method: 'GET',
    params,
  });
}
// 查询班组组织架构公共
export async function getGroupWorkerByGroupIdApi(params?: any) {
  return request('/api/detail/projectGroupWorker/getGroupWorkerByGroupId', {
    method: 'GET',
    params,
  });
}


// html模板填充
export async function genWarnLawHtml(params?: any) {
  return request('/oa/project/genWarnLawHtml', {
    method: 'GET',
    params,
  });
}
// 下发文书-html转PDF
export async function genWarnLawPdf(params: any) {
  return request('/oa/project/genWarnLawPdf', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}
// 法律文书下发
export async function urgeFileUpload(params: any) {
  return request('/oa/project/urgeFiles', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}

// 保存公示公告
export async function savePublicity(params: any) {
  return request('/oa/publicity/save', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}
// 编辑公示公告
export async function updatePublicity(params: any) {
  return request('/oa/publicity/update', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}
//删除公示公告
export async function deletePublicity(params: any) {
  return request('/oa/publicity/delete', {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}

// 单个查询工人详细信息
export async function getById(params: any) {
  return request('/api/projectGroupWorker/getById', {
    method: 'GET',
    params
  });
}

// 统计花名册数据
export async function countWorker(params: any) {
  return request('/api/projectGroupWorker/countWorker', {
    method: 'GET',
    params
  });
}

// 修改手机号前检查
export async function changePhoneCheck(params: any) {
  return request('/oa/projectGroupWorker/changePhoneCheck', {
    method: 'GET',
    params
  });
}

// 贷款详情
export async function borrowDetail(params: any) {
  let url: string = ''
  switch (params.type) {
    case 'construction'://施工端
      url = '/api/loan/detail'
      break;
    case 'bank'://银行端
      url = '/bank/loanApply/detail'
      break;
    case 'labor'://牢监端
      url = '/oa/loan/detail'
      break;
    case 'platform'://平台端
      url = '/tp/sjb/loanApply/detail'
      break;
    case 'guarantee':
      url = '/tp/loanApply/detail'
    default:
      break;
  }
  return request(url, {
    method: 'GET',
    params: { id: params.id }
  });
}
//贷款审核
export async function borrowCheck(params: any, type: string) {
  let url: string = ''
  switch (type) {
    case 'construction'://施工端
      url = '/api/loan/detail'
      break;
    case 'bank'://银行端
      url = '/bank/loanApply/check'
      break;
    case 'labor'://牢监端
      url = '/oa/loan/check'
      break;
    case 'guarantee'://平台端
      url = '/tp/loanApply/check'
      break;
    default: //平台数金保
      url = '/tp/sjb/loanApply/check'
      break;
  }
  return request(url, {
    method: 'POST',
    data: params,
    requestType: 'form',
  });
}
// 修改手机号
export async function changePhone(params: any) {
  return request('/oa/projectGroupWorker/changePhone', {
    method: 'POST',
    data: params,
    requestType: 'form',
  })
}
//发放贷款审核
export async function sendBorrowCheck(params: any) {
  return request('/bank/loanApply/giveLoanCheck', {
    method: 'POST',
    data: params,
    requestType: 'form',
  })
}
//还款申请审核
export async function bankRepayLoanCheck(params: any) {
  return request('/bank/repayLoanApply/bankRepayLoanCheck', {
    method: 'POST',
    data: params,
    requestType: 'form',
  })
}
//担保公司列表
export async function companysLists(params: any) {
  return request('/api/thirdPlatform/list', {
    method: 'GET',
    params
  });
}
// 申请还贷
export async function repayLoanApply(params: any) {
  return request('/api/loan/repayLoanApply', {
    method: 'POST',
    data: params,
    requestType: 'form',
  })
}

/**
 * 获取项目类目
 * @param params 
 */
export async function getProjectCategory() {
  return request('/open/category/list', {
    method: 'GET'
  });
}

// 专户账户历史列表
export async function accountList(params: any) {
  return request('/api/detail/specialAccount/accountList', {
    method: 'GET',
    params
  });
}

  // 实名制管理-工程款支付担保信息详情
  export async function projectPaymentGuarantee(params:any) {
    return request('/api/detail/project/projectPaymentGuarantee', {
      method: 'GET',
      params
    });
  }